#!/bin/bash
#PBS -A lc_op
#PBS -l nodes=1:ppn=1
#PBS -l walltime=00:30:00
#PBS -l pvmem=1000mb
#PBS -o qespresso.out
#PBS -j oe
#PBS -N my_job
#PBS -m n
#PBS -V 


exe_qespresso=/usr/usc/qespresso/5.1/gnu/bin/pw.x
exe_export=/usr/usc/qespresso/5.1/gnu/bin/pw_export.x
exe_convert=/usr/usc/qespresso/5.1/gnu/bin/iotk


res=/home/rcf-40/akimov/Soft1/tutorials/Tut2_small_copy/step2/res


# These will be assigned automatically, leave them as they are
param1=
param2=


# This is invocation of the scripts which will further handle NA-MD calclculations
# on the NAC calculation step
python -c "from PYXAID import *
params = { }
params[\"NP\"]=$NP
params[\"EXE\"]=\"$exe_qespresso\"
params[\"EXE_EXPORT\"]=\"$exe_export\"
params[\"EXE_CONVERT\"] = \"$exe_convert\"
params[\"start_indx\"]=$param1
params[\"stop_indx\"]=$param2
params[\"wd\"]=\"wd_test\"
params[\"rd\"]=\"$res\"
params[\"minband\"]=1
params[\"nocc\"]=6
params[\"maxband\"]=20
params[\"nac_method\"]=0
params[\"wfc_preprocess\"]=\"complete\"
params[\"do_complete\"]=1
params[\"prefix0\"]=\"x0.scf\"
params[\"prefix1\"]=\"x1.scf\"
params[\"compute_Hprime\"]=0
print params
runMD1.runMD(params)
"






cd $PBS_O_WORKDIR
echo $PBS_O_WORKDIR

# Don't forget to source right MPI library:
source /usr/usc/openmpi/1.8.1/gnu/setup.sh

NP=$(wc -l $PBS_NODEFILE | awk '{print $1}')
echo $NP

mpirun -n $NP $exe_qespresso < x.md.in > x.md.out

